Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Extend Dallas 1-Wire] Add support for read PIO-A of DS2406 #2174

Merged
merged 2 commits into from
Mar 12, 2020

Conversation

rmcbc
Copy link
Contributor

@rmcbc rmcbc commented Mar 8, 2020

Extend Dallas 1-Wire

Extend the devices supported with DALLAS 1-WIRE.
The DS2406 can be read, the system adds it as a digital device and only read PIO-A state.

Electronics

  1. Connect a 3.3Kohm resistor from pin 3.3V to IO2 (pad after 3.3V hole) on a Sonoff Basic R2.
  2. Take 3 wires: GND, 3.3V and IO2 (I think is GPIO14)
  3. Connect DS2406 pin 1 to GND, pin 2 to IO2 and pin 3 is the input port

Just a Note: if it's to receive a signal from a relay I put a 10K resistor to 3.3v as a pull up or to GND as a pull down depending if relay NC is GND or 3.3v and NO is a open signal)

Devices

To have access to DALLAS devices I use in platformio:
default_envs = itead-sonoff-basic-r2-dallas

You can mix DS18x20 devices with this new DS2406.

Because only have 5 units of DS2406, I test all in the same Sonoff, it detects all and work without any problem.

@rmcbc rmcbc changed the title Add support for read PIO-A of DS2406 [Extend Dallas 1-Wire] Add support for read PIO-A of DS2406 Mar 8, 2020
for (unsigned char i = 0; i < DS_DATA_SIZE; i++) {
data[i] = _wire->read();
}
_wire->reset();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have noticed that the other sections does check for the 'expected' return value. Should it do the same here, and the one reset() below?

https://github.com/PaulStoffregen/OneWire/blob/master/OneWire.cpp#L164

// Returns 1 if a device asserted a presence pulse, 0 otherwise.

Based on the commit history, hot-plugging is the reason for that branch:
90c5155

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcspr you were right, sorry for that.
Fixed, thanks.

@mcspr mcspr merged commit ae232c9 into xoseperez:dev Mar 12, 2020
@mcspr mcspr added this to the 1.14.2 milestone Mar 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants